package net.zoneland.knowledge.controller.redBase;

import net.zoneland.knowledge.controller.AbstractBaseController;
import net.zoneland.knowledge.controller.bean.RedBaseRouteQueryVo;
import net.zoneland.knowledge.controller.redBase.service.RedBaseService;
import net.zoneland.knowledge.controller.redBase.service.RedRouteService;
import net.zoneland.knowledge.model.ResponseResultRest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * 查询红色教育基地.
 */
@RestController
@RequestMapping("/rededu")
public class RedEducationBaseController extends AbstractBaseController {
    /**
     * 日志.
     */
    private static final Logger LOGGER = LoggerFactory.getLogger(RedEducationBaseController.class);

    /**
     * 红色基地业务接口.
     */
    @Autowired
    private RedBaseService redBaseService;

    /**
     * 红色路线接口.
     */
    @Autowired
    private RedRouteService redRouteService;

    /**
     * 查询红色教育基地列表.
     * @param request
     * @param vo
     * @return
     */
    @PostMapping("/queryRedRouteList")
    public ResponseResultRest queryRedEduBaseList(final HttpServletRequest request, @RequestBody final RedBaseRouteQueryVo vo) {
        return ResponseResultRest.success(redRouteService.queryList(vo));
    }

    /**
     *
     * 查询红色路线详情.
     * @param request
     * @param id
     * @retu
     */
    @PostMapping("/queryRedRouteDetail")
    public ResponseResultRest queryRedDetail(final HttpServletRequest request, @RequestBody final String id) {
        return ResponseResultRest.success(redRouteService.queryById(id));
    }

    /**
     * 查询红色教育基地详情.
     * @param request
     * @param id
     * @return
     */
    @PostMapping("/queryRedBaseDetail")
    public ResponseResultRest queryRedBaseDetail(final HttpServletRequest request, @RequestBody final String id) {
        return ResponseResultRest.success(redBaseService.queryById(id));
    }


    @PostMapping("/queryRedBaseList")
    public ResponseResultRest queryRedBaseList(final HttpServletRequest request, @RequestBody final RedBaseRouteQueryVo vo) {
        return ResponseResultRest.success(redBaseService.queryList(vo));
    }

}
